<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <div class="box" @click="boxFn">
      <!-- .stop 修饰符 就是来组织冒泡的 -->
      <button @click.stop="btnFn">按钮</button>
    </div>

    <!-- .prevent 修饰符 阻止默认行为 -->
    <a href="http://www.baidu.com" @click.prevent="aFn">测试</a>
  </div>
  <script src="./vue.js"></script>

  <script>
    new Vue({
      el: '#app',
      data: {},
      methods: {
        boxFn: function() {
          console.log('我是box函数')
        },
        btnFn: function(e) {
          // e.stopPropagation()  // 原声js组织冒泡
          console.log('我是btn函数')
        },
        aFn: function(e) {
          // e.preventDefault()  // 原声js 阻止默认行为
        }
      }
    })
  </script>
</body>
</html>